﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Security.Cryptography;

namespace HCSExtensions
{
    public class EncryptionManager
    {
        public static string Encrypt(string md5Text)
        {
            MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
            byte[] hashedBytes;
            UTF8Encoding encoder = new UTF8Encoding();
            hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(md5Text));

            StringBuilder hash = new StringBuilder();
            for (int i = 0; i < hashedBytes.Length; i++)
            {
                hash.AppendFormat("{0:x2}", hashedBytes[i]);
            }

            return hash.ToString();
        }
    }
}
